services:
  roots_of_past:
    container_name: roots_of_past
    restart: always
    build:
      dockerfile: ./docker/Dockerfile
      context: ../
    ports:
      - "3443:3443"
    command: /usr/bin/rootsOfPast
    environment:
      TZ: Europe/Moscow
    networks:
      - back-end
    depends_on:
      pg_db:
        condition: service_healthy
  pg_db:
    container_name: postgres
    image: postgres:latest
    restart: always
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_USER: howiam
      POSTGRES_DB: howareyou
      PGDATA: "/var/lib/postgresql/data/pgdata"
    volumes:
      - /tmp/pgdata:/var/lib/postgresql/data
    ports:
      - 5432:5432
    networks:
      - back-end
    healthcheck:
      # test: ["CMD-SHELL", "pg_isready -U howiam"]
      # a more complete command
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h 127.0.0.1"]
      interval: 2s
      timeout: 10s
      retries: 5
    # deploy:
    #   resources:
    #     limits:
    #       cpus: "1"
    #       memory: 4G
networks:
  back-end:
    driver: bridge
